exports.install = (app) => {
    app.config.globalProperties.getHashParam = function (name) {
        const w = location.hash.indexOf('?');
        const query = location.hash.substring(w + 1);
        const vars = query.split('&');
        for (let i = 0; i < vars.length; i++) {
          const pair = vars[i].split('=');
          if (pair[0] == name) { return pair[1]; }
        }
        return null;
    },
    app.config.globalProperties.hidePhone = (value) => {
      if(value){
        return value.substring(0,3) + '****' + value.substring(value.length-4)
      }else{
          return '-'
      }
    },
    // 保留后四位
    app.config.globalProperties.lastFour = (value) => {
      if(value){
        return value.substring(value.length - 4,value.length)
      }else{
        return value
      }
    }
    // 外放充值订单状态
    app.config.globalProperties.externalOrderStatus = (orderStatus) => {
      let statusStr = '待执行';
      console.log(orderStatus,'orderStatus')
      switch(orderStatus){
          case '1':
              statusStr = '已成功';
              break;
          case '2':
              statusStr = '已失败';
              break;
          case '3':
              statusStr = '充值中';
              break;
          case '4':
              statusStr = '退款中';
              break;
          case '5':
              statusStr = '退款成功';
              break;
          case '6':
              statusStr = '待付款';
              break;
          case '7':
              statusStr = '已取消';
              break;
          case '8':
              statusStr = '部分成功';
              break;
      }
    return statusStr;
  }
}